package com.example.helloword.reflect;

/**
 * 通过调用Class中的getInterfaces，获取当前类(不包括父类)实现的接口
 */
public class InterfaceMain {
    public static void main(String[] args) throws Exception {
//        method2(InterfaceMain.class);
        Class s = Integer.class;
        Class[] is = s.getInterfaces();
        for (Class i : is) {
            System.out.println(i);
        }
        method1();
    }

    /**
     * 获取父类实现的接口
     *  method1
     */
    private static void method1() {
        System.out.println("------");
        Class s = Integer.class.getSuperclass();
        Class[] is = s.getInterfaces();
        for (Class i : is) {
            System.out.println(i);
        }
    }

}
